package com.tsu.mall.order.Controller;

import com.tsu.mall.common.entity.Bill;
import com.tsu.mall.common.service.IBillDetailService;
import com.tsu.mall.common.service.IBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/billSuccess")
public class BillSuccessController {
    @Autowired
    private IBillService iBillService;
    @GetMapping("/billSuccessPage")
    public String billSuccessPage(Model model, String billCode,String qrcode){
        model.addAttribute("billCode",billCode);
        model.addAttribute("qrcode",qrcode);
        Integer billId=iBillService.doSelectByCode(billCode);
        model.addAttribute("billId",billId);
        return "billSuccess";
    }
    @PostMapping("/payStatus")
    @ResponseBody
    public String payStatus(Integer id){
        Bill bill=iBillService.selectById(id);
        return bill.getStatus();
    }
}
